
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.List;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Mr Bao
 */
public class ViewImage extends List implements CommandListener {

    private UpAnh upAnh;
    private Command cmdBack = new Command("Back", Command.BACK, 2);

    public ViewImage(UpAnh upAnh) {
        super("Xem Anh", IMPLICIT);
        this.upAnh = upAnh;
        append("Xem anh trong may", null);
        append("Xem cua minh", null);
        append("Xem anh moi dang", null);
        append("Tim kiem", null);
        addCommand(cmdBack);
        setCommandListener(this);
    }

    public void commandAction(Command c, Displayable d) {
        if (c == SELECT_COMMAND) {
            switch (getSelectedIndex()) {
                case 0:
                    upAnh.DisplayViewBrowser();
                    break;
                case 1:
                    upAnh.DisplayViewAlbum();
                    break;
                case 2:
                    upAnh.client.ViewNewUpload();
                    upAnh.DisplayViewImageNameNew();
                    break;
                case 3:
                    upAnh.DisplayTimkiem();
                    break;
            }
        } else if (c == cmdBack) {
            upAnh.DisplayHomeMain();
        }
    }
}
